package com.hiof.servercommunication.receive.beans;

import com.hiof.utility.Utility;

public class TargetInfoPacket implements Packet{

    private String targetName;
    private double predictedTime;//in minutes
    private double distance; //in meters
    private GeoPoint geoPoint;

    public TargetInfoPacket(){}

    public TargetInfoPacket(String targetName, double predictedTime, double distance, GeoPoint geoPoint) {
        this.targetName = targetName;
        this.predictedTime = predictedTime;
        this.distance = distance;
        this.geoPoint = geoPoint;
    }

    public String getTargetName() {
        return this.targetName;
    }

    public void setTargetName(String targetName) {
        this.targetName = targetName;
    }

    public double getPredictedTime() {
        return this.predictedTime;
    }

    public void setPredictedTime(double predictedTime) {
        this.predictedTime = predictedTime;
    }

    public String getMessage() {
        String distanceString = Utility.getFormattedDistance(distance) + " away from " + targetName;
        String predictedTimeString = Utility.getFormattedTime(predictedTime);
        if (distance == 0)
            return "Already finished the route";
        if("".equals(predictedTimeString)){
            return distanceString;
        }else{
            return distanceString + ", and " + Utility.getFormattedTime(predictedTime) + " to reach.";
        }
    }

    public double getDistance() {
        return this.distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public GeoPoint getGeoPoint() {
        return geoPoint;
    }

    public void setGeoPoint(GeoPoint geoPoint) {
        this.geoPoint = geoPoint;
    }
}
